/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.MailItem.Type;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class SetFolderDefaultView
/*    */   extends RedoableOp
/*    */ {
/*    */   private int mFolderId;
/*    */   private MailItem.Type defaultView;
/*    */   
/*    */   public SetFolderDefaultView()
/*    */   {
/* 34 */     super(MailboxOperation.SetFolderDefaultView);
/* 35 */     this.mFolderId = -1;
/* 36 */     this.defaultView = MailItem.Type.UNKNOWN;
/*    */   }
/*    */   
/*    */   public SetFolderDefaultView(int mailboxId, int folderId, MailItem.Type view) {
/* 40 */     this();
/* 41 */     setMailboxId(mailboxId);
/* 42 */     this.mFolderId = folderId;
/* 43 */     this.defaultView = view;
/*    */   }
/*    */   
/*    */   protected String getPrintableData()
/*    */   {
/* 48 */     StringBuilder sb = new StringBuilder("id=").append(this.mFolderId);
/* 49 */     sb.append(", view=").append(this.defaultView);
/* 50 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException
/*    */   {
/* 55 */     out.writeInt(this.mFolderId);
/* 56 */     out.writeByte(this.defaultView.toByte());
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException
/*    */   {
/* 61 */     this.mFolderId = in.readInt();
/* 62 */     this.defaultView = MailItem.Type.of(in.readByte());
/*    */   }
/*    */   
/*    */   public void redo() throws Exception
/*    */   {
/* 67 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 68 */     mbox.setFolderDefaultView(getOperationContext(), this.mFolderId, this.defaultView);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/SetFolderDefaultView.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */